package grammer.components;

/**
 * 
 * 
 * @author Minodor
 * 
 *         Enumeration for time
 */
public enum TimeEnum implements Component {
	AT_X, FROM_X_FOR_Y_MINUTES, FROM_X_TO_Y, GENERIC_TIME;
	@Override
	public Component match(String toMatch) {
		if (toMatch.startsWith("at"))
			return AT_X;
		if (toMatch.contains("to") && toMatch.contains("from"))
			return FROM_X_TO_Y;
		if (toMatch.contains("for") && toMatch.contains("from"))
			return FROM_X_FOR_Y_MINUTES;
		return null;
	}

	@Override
	public String toString() {
		switch (this) {
		case AT_X:
			return "at_X";
		case FROM_X_TO_Y:
			return "from_X_to_Y";
		case FROM_X_FOR_Y_MINUTES:
			return "from_x_for_y_minutes";
		default:
			return "time";
		}

	}
}
